package com.cn.wangxin.user;

import com.cn.wangxin.MyRatelimiter;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import javax.annotation.Resource;

/**
 * 功能描述 TODO
 *
 * @Created Time 2016/10/20
 * @Edited Time 2016/10/20
 * @Created by wangxin43
 */
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = {"/applicationContext.xml"})
public class ratelimitertest {
    @Resource
    MyRatelimiter myRatelimiter;

    @Test
    public void ss(){
        System.out.println("ss"+myRatelimiter.getRateLimiter().acquire());
        System.out.println("ss"+myRatelimiter.getRateLimiter().acquire());
        System.out.println("ss"+myRatelimiter.getRateLimiter().acquire());
        System.out.println("ss"+myRatelimiter.getRateLimiter().acquire());
        System.out.println("ss"+myRatelimiter.getRateLimiter().acquire());
    }
}
